extends AnimatedSprite

onready var Game = get_tree().current_scene.get_node(".")

var life = 300

func _ready():
	pass

func _on_Timer_timeout():
	var sun = load("res://object/sun.tscn").instance()
	add_child(sun)
	#print_debug("added",sun)
	pass # Replace with function body.

func _on_Area2D_input_event(viewport, event, shape_idx):
	if event is InputEventMouseButton and Game.use_shovel:
		if event.is_pressed() and event.button_index == BUTTON_LEFT:
			Game.reset_shovel()
			Game.use_shovel = false
			self.queue_free()
	pass

func _process(delta):
	if life <=0:
		queue_free()
	
func _on_Area2D_body_entered(body):
	if body.has_meta("is_zombie"):
		body.stop()
		body.play_attack()
		body.plant = self
	pass # Replace with function body.
